<template>
  <div class="xiecheng">
    <div class="admin_main_block">
      <div class="admin_main_block_top">
        <div class="admin_main_block_right">
          <div>
            <el-button
              v-if="isAuth('module:member:behavior:delete')"
              type="danger"
              icon="Delete"
              @click="deleteHandle()">
              {{ i18n('common.batch_delete') }}
            </el-button>
          </div>
        </div>
      </div>

      <div class="admin_main_block_select">
        <div class="date">
          <el-date-picker v-model="dataForm.create_time" type="daterange" :range-separator="$t('common.to')" :start-placeholder="$t('common.start_time')" :end-placeholder="$t('common.end_time')" clearable>
          </el-date-picker>
        </div>
        <div class="input">
          <el-button icon="Search" @click="getDataList(true)">
            {{ i18n('common.search') }}
          </el-button>
        </div>
      </div>

      <div class="admin_table_main">
        <el-card class="box-card" shadow="never">
          <template v-slot:header>
            <div class="clearfix">
              <span>{{ i18n('member.behavior.base_info') }}</span>
            </div>
          </template>
          <div class="text item">
            <el-row :gutter="16">
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
              <el-col :span="4">
                <numerical-statistics />
              </el-col>
            </el-row>
          </div>
        </el-card>
      </div>
    </div>
  </div>
</template>

<script setup name="member-behavior-list">
  import { useBase } from "@/hooks/base/useBase"
  import { useTable } from "@/hooks/table/useTable"

  import NumericalStatistics from '@/components/statistical/numerical'

  const { router, query, i18n, isAuth } = useBase()

  const model = ref('member/behavior')

  const dataForm = reactive([
    'create_time',
  ])

  const {
    dataList,
    pageIndex,
    pageSize,
    totalPage,
    dataListLoading,
    sizeChangeHandle,
    currentChangeHandle,
    selectionChangeHandle,
    getDataList,
    deleteHandle,
  } = useTable(model.value, dataForm)


  onMounted(() => {
    dataForm.member_id = query.member_id || 0

    getDataList(model)
  })
</script>
